﻿package  {
	
	import flash.display.MovieClip;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	

	
	public class Road extends MovieClip {
		
		private var pContainer:MovieClip;
		
		private var speed:Number=3;

		//timer
		private var moveTimer:Timer;
		
		// Initialization:
		public function Road(pContainer:MovieClip,x:int,y:int) {
			
			this.pContainer=pContainer;
			init(x,y);
			
		}
		
		private function init(x:int,y:int):void {
			this.x = x;
			this.y = y;
			pContainer.addChild(this);
			
			moveTimer=new Timer(30,0);
			moveTimer.addEventListener(TimerEvent.TIMER,timerIng);
			moveTimer.start();
		}
		
		private function timerIng(e:TimerEvent):void {
			if(this.y<=5000)
			this.y+=speed;
		}
	}
		
		
	
}